<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

//$this->title = 'Products';
$this->title = backend\models\Product::getCTableName() . '管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">

    <h1><?= Html::encode($this->title) ?></h1>
	<?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
		<?= Html::a('添加' . $this->title, ['create'], ['class' => 'btn btn-success']) ?>
    </p>
	<?=
	GridView::widget([
		'dataProvider' => $dataProvider,
		'filterModel' => $searchModel,
		'columns' => [
				['class' => 'yii\grid\SerialColumn'],
            'productId',
//			'categoryId',
			['attribute' => 'categoryId',
				'value' => function($date) {
					return backend\models\Category::getCategoryList_S(2)[$date->categoryId];
				}
			],
			'title',
//			'description:ntext',
			'number',
			// 'price',
			// 'cover',
			// 'pictures:ntext',
			// 'issale',
			// 'ishot',
			// 'istui',
			// 'saleprice',
			// 'ison',
			// 'createTime',
			['class' => 'yii\grid\ActionColumn'],
		],
	]);
	?>
</div>
